import request from '@/utils/request'

// 合同分页列表
export function pageContract(data) {
  return request({
    url: '/contract/page',
    method: 'POST',
    data: data
  })
}
// 新增合同
export function addContract(data) {
  return request({
    url: '/contract',
    method: 'POST',
    data: data
  })
}
// 修改合同
export function updateContract(data) {
  return request({
    url: '/contract',
    method: 'PUT',
    data: data
  })
}
// 删除合同
export function delContract(id) {
  return request({
    url: '/contract/' + id,
    method: 'DELETE'
  })
}
// 合同模板下载
export function downloadContractTemplate(params) {
  return request({
    url: '/contract/download/contract-template',
    method: 'GET',
    params,
    responseType: 'blob'
  })
}
// 回款记录模板下载
export function downloadPaymentRecordTemplate(params) {
  return request({
    url: '/contract/download/payment-record-template',
    method: 'GET',
    params,
    responseType: 'blob'
  })
}
// 导入合同信息
export function importContracts(data) {
  return request({
    url: '/contract/import/contracts',
    method: 'POST',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
// 导入回款记录信息
export function importPaymentRecordTemplate(data) {
  return request({
    url: '/contract/import/payment-record-template',
    method: 'POST',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}
// 导入回款记录信息
export function listDetail(id) {
  return request({
    url: '/contract/' + id,
    method: 'GET'
  })
}

